package com.ncucoder.demo.mapper;

import com.ncucoder.demo.model.Customer;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Customer data access object
 *
 * @author <a href="https://edit.ncucoder.com">hsowan</a>
 * @since 2018-12-24 13:14
 */
@Component
public interface CustomerMapper {

    /**
     * get customer by primary key
     *
     * @param id primary key
     * @return com.ncucoder.demo.model.Customer
     */
    Customer getCustomerById(Long id);

    /**
     *
     * @param min oracle pagination
     * @param max oracle pagination
     * @param startIndex mysql pagination
     * @param pageSize mysql pagination
     * @return
     */
    List<Customer> listCustomers(int min, int max, int startIndex, int pageSize);

    /**
     * insert customer
     *
     * @param customer com.ncucoder.demo.model.Customer
     * @return save result
     */
    int saveCustomer(Customer customer);

    /**
     * delete customer by primary key
     *
     * @param id 用户主键
     * @return delete result
     */
    int deleteCustomerById(Long id);

    /**
     * update customer
     *
     * @param customer com.ncucoder.demo.model.Customer
     * @return update result
     */
    int updateCustomer(Customer customer);

    /**
     * 获取用户总数
     *
     * @return int
     */
    int count();
}
